#include <iostream>
#include <algorithm>
using namespace std;

long long n, m, a, b;
int main()
{
    cin >> n >> m >> a >> b;
    long long ret = 0;
    for (long long i = 0; i <= min(n / 2, m); i++)
    {
        long long j = min(n - i * 2, (m - i) / 2);
        ret = max(ret,(a * i + b * j));
    }
    cout << ret << endl;
    return 0;
}

#include <cstddef>
#include <iostream>
using namespace std;

const int N = 1e5 + 10;
int n;

int arr[N];

int main()
{
    cin >> n;
    int ret = 0;
    for (int i = 0; i < n; i++) cin >> arr[i];
    for (int i = 1; i < n; i++)
    {
        if (arr[i] > arr[i - 1])
        {
            ret += arr[i] - arr[i - 1];
        }
    }
    cout << ret << endl;
}

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
    string s;
    getline(cin, s);
    reverse(s.begin(), s.end());
    int left = 0, n = s.size();
    while (left < n)
    {
        int right = left;
        while (right < n && s[right] != ' ') right++;

        reverse(s.begin() + left, s.begin() + right);

        while (right < n && s[right] == ' ') right++;

        left = right;
    }


    cout << s << endl;

    return 0;
}